if (space == babl_space ("sRGB"))
babl->format.model = model;
else
- babl->format.model = babl_remodel_with_space (model, space);
+ babl->format.model = (void*)babl_remodel_with_space ((void*)model, space);
memcpy (babl->format.component, component, sizeof (BablComponent *) * components);
memcpy (babl->format.type, type, sizeof (BablType *) * components);
{
_babl_space_from_xyz (space, xyz, rgb);
}
+
+double * babl_space_get_rgbtoxyz (const Babl *space)
+{
+ return space->space.RGBtoXYZ;
+}
const Babl *trc_green,
const Babl *trc_blue);
+double * babl_space_get_rgbtoxyz (const Babl *space);
+void babl_space_to_xyz (const Babl *space, const double *rgb, double *xyz);
+void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
+
/**
* babl_format:
*
#include "babl-classes.h"
#include "babl.h"
#include "babl-ids.h"
-#include "rgb-constants.h"
#include "math.h"
#include "babl-base.h"
char *dst,
long n)
{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double RGB_LUMINANCE_RED = space->space.RGBtoXYZ[3];
+ double RGB_LUMINANCE_GREEN = space->space.RGBtoXYZ[4];
+ double RGB_LUMINANCE_BLUE = space->space.RGBtoXYZ[5];
+
while (n--)
{
double red, green, blue;
char *dst,
long n)
{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double RGB_LUMINANCE_RED = space->space.RGBtoXYZ[3];
+ double RGB_LUMINANCE_GREEN = space->space.RGBtoXYZ[4];
+ double RGB_LUMINANCE_BLUE = space->space.RGBtoXYZ[5];
+
while (n--)
{
double red, green, blue;
{
const Babl *space = babl_conversion_get_destination_space (conversion);
const Babl *trc = space->space.trc[0];
+ double RGB_LUMINANCE_RED = space->space.RGBtoXYZ[3];
+ double RGB_LUMINANCE_GREEN = space->space.RGBtoXYZ[4];
+ double RGB_LUMINANCE_BLUE = space->space.RGBtoXYZ[5];
+
BABL_PLANAR_SANITY
while (n--)
{
int *dst_pitch,
long n)
{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double RGB_LUMINANCE_RED = space->space.RGBtoXYZ[3];
+ double RGB_LUMINANCE_GREEN = space->space.RGBtoXYZ[4];
+ double RGB_LUMINANCE_BLUE = space->space.RGBtoXYZ[5];
+
BABL_PLANAR_SANITY;
assert (src_bands == 4);
assert (dst_bands == 2);
{
const Babl *space = babl_conversion_get_destination_space (conversion);
const Babl *trc = space->space.trc[0];
+ double RGB_LUMINANCE_RED = space->space.RGBtoXYZ[3];
+ double RGB_LUMINANCE_GREEN = space->space.RGBtoXYZ[4];
+ double RGB_LUMINANCE_BLUE = space->space.RGBtoXYZ[5];
while (n--)
{
+++ /dev/null
-/* babl - dynamically extendable universal pixel conversion library.
- * Copyright (C) 2005, Øyvind Kolås.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-/*
- * These sRGB Y values have been adapted to the ICC spec D50 illuminant.
- * They match the Y values in the GEGL and GIMP built-in sRGB profiles,
- * which match the Y values in the ArgyllCMS sRGB.icm profile.
- *
- * For more information, see this thread and these bug reports:
- * https://mail.gnome.org/archives/gimp-developer-list/2013-September/msg00113.html
- * https://bugzilla.gnome.org/show_bug.cgi?id=723787
- * https://bugzilla.gnome.org/show_bug.cgi?id=724822
- */
-
-#define RGB_LUMINANCE_RED (0.22248840)
-#define RGB_LUMINANCE_GREEN (0.71690369)
-#define RGB_LUMINANCE_BLUE (0.06060791)
#include "babl.h"
#include "base/util.h"
-#include "base/rgb-constants.h"
#include "extensions/util.h"
/* There was some debate on #gimp about whether these constants
*/
/* Float versions of the double constants in rgb-constants.h */
-static const float RGB_LUMINANCE_RED_FLOAT = RGB_LUMINANCE_RED;
-static const float RGB_LUMINANCE_GREEN_FLOAT = RGB_LUMINANCE_GREEN;
-static const float RGB_LUMINANCE_BLUE_FLOAT = RGB_LUMINANCE_BLUE;
static long
conv_rgbaF_linear_y8_linear (const Babl *conversion,unsigned char *src,
unsigned char *dst,
long samples)
{
- static const float RGB_LUMINANCE_RED_FLOAT = RGB_LUMINANCE_RED;
- static const float RGB_LUMINANCE_GREEN_FLOAT = RGB_LUMINANCE_GREEN;
- static const float RGB_LUMINANCE_BLUE_FLOAT = RGB_LUMINANCE_BLUE;
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double *rgbtoxyz = babl_space_get_rgbtoxyz (space);
+ const float RGB_LUMINANCE_RED_FLOAT = rgbtoxyz[3];
+ const float RGB_LUMINANCE_GREEN_FLOAT = rgbtoxyz[4];
+ const float RGB_LUMINANCE_BLUE_FLOAT = rgbtoxyz[5];
float *s = (float *) src;
long n = samples;
unsigned char *dst,
long samples)
{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double *rgbtoxyz = babl_space_get_rgbtoxyz (space);
+ const float RGB_LUMINANCE_RED_FLOAT = rgbtoxyz[3];
+ const float RGB_LUMINANCE_GREEN_FLOAT = rgbtoxyz[4];
+ const float RGB_LUMINANCE_BLUE_FLOAT = rgbtoxyz[5];
float *s = (float *) src;
float *d = (float *) dst;
unsigned char *dst,
long samples)
{
+ const Babl *space = babl_conversion_get_source_space (conversion);
+ double *rgbtoxyz = babl_space_get_rgbtoxyz (space);
+ const float RGB_LUMINANCE_RED_FLOAT = rgbtoxyz[3];
+ const float RGB_LUMINANCE_GREEN_FLOAT = rgbtoxyz[4];
+ const float RGB_LUMINANCE_BLUE_FLOAT = rgbtoxyz[5];
float *s = (float *) src;
float *d = (float *) dst;